#include<pthread.h>
#include<iostream>
#include<string>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
 
using namespace std;
class res{
  public:
    res(int x):_rs(x){}
   int  getres(){ return _rs;}
    ~res(){}
  private:
  int  _rs;
};

class Multiply{
  public:
      Multiply(int x,int y):_a(x),_b(y){ }
       res out(){  return res(_a*_b);}
      ~Multiply(){}
  private:
  int _a;
  int _b;
};
void *routine(void *arg){
    class Multiply *mp=static_cast<class Multiply*>(arg);
     res *pr=new class res(mp->out());
     return (void*)pr;
}
int main(){
    pthread_t tid;
    class Multiply* M=new class Multiply(10,20);
    int n=pthread_create(&tid,nullptr,routine,(void*)M);
    sleep(1);
    void *ret=nullptr;
    pthread_join(tid,&ret);
     cout<<"结果是： "<< ((class res*)ret)->getres()<<endl;
     delete M;
     delete (class res*)ret;


}